package com.ksd.sbf;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import org.apache.commons.lang.math.RandomUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import net.sf.json.JSONObject;


@RestController
public class AngularAction {
	
	
	@RequestMapping("/angular/citys/data")
	public String index() {
		List<City> citys = new ArrayList<>();
		for(int i=0;i<10;i++){
			City city = new City();
			city.setName("city"+i);
			city.setNumber(RandomUtils.nextInt(1000));
			citys.add(city);
		}
		
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("citys", citys);
		return jsonObject.toString();
	}
}
